#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import rospy
from learn_topic_userdef.msg import Product

class UserSubscribe:
    def __init__(self):
        rospy.init_node('product_subscriber', anonymous=True)
        rospy.Subscriber('product_info', Product, UserSubscribe.msg_subscribe)

    def msg_subscribe(msg):
        rospy.loginfo("Publish product info: name:%s,type:%d,function:%s", msg.name, msg.type, msg.function)

if __name__ == '__main__':
    node = UserSubscribe()
    rospy.spin()